package com.threadpool.pool.policy;

import com.threadpool.pool.CustomThreadPool;

/**
 * <p>
 * 交给调用线程执行策略
 * </p>
 *
 * @author 桌角的眼镜
 * @version 1.0
 * @since 2025/5/14 0:50
 */
public class CallerRunsPolicy<T> implements RejectPolicy<T> {
    @Override
    public void reject(T task, CustomThreadPool pool) {
        if (task instanceof Runnable) {
            ((Runnable) task).run();
        }
    }
}
